#ifndef __CLIENT_CACHE_H__
#define __CLIENT_CACHE_H__

#include <map>
#include "IUtility.h"
#include "IClient.h"
#include "IPacket.h"
#include "IProcessClientRisk.h"
#include "ISysResources.h"

typedef struct
{
	shared_ptr<IPacket> ptrData;
	shared_ptr<ILock> ptrLock;
}ST_DataSet;

class CClientCache: public virtual ICientCache
{
INIT_CLASS_SINGLETON(CClientCache)
public:
	const bool Init(const void * pvdPara, char * pszMsgTxt, int iMsgTxtSize);
	bool LoadRiskInfo(const char * pszLbmNo, const char * pszKey, const char * pszInPara);
	bool RegisterLbmResult(const char * pszLbmNo, const char * pszKey, const char * pszLbmResult);
	const char * GetValueAsString(const char * pszLbmNo, const char * pszKey, const char * pszFieldName, char * pszValue, int iSize, const int iRecNo = 1);
	long long GetValueAsInt(const char * pszLbmNo, const char * pszKey, const char * pszFieldName, const int iRecNo = 1);
	double GetValueAsFloat(const char * pszLbmNo, const char * pszKey, const char * pszFieldName, const int iRecNo = 1);
	bool GetValueAsBool(const char * pszLbmNo, const char * pszKey, const char * pszFieldName, const int iRecNo = 1);

private:
	map<string, shared_ptr<ST_DataSet>> m_mpResult;//LbmNo, Key, IPacket
	shared_ptr<IStrFun> m_ptrStrFun;
	shared_ptr<IClient> m_ptrClient;
private:
	shared_ptr<ST_DataSet> NewDataSet(const char * pszLbmNo, const char * pszKey);
	shared_ptr<ST_DataSet> GetDataSet(const char * pszLbmNo, const char * pszKey);
};



#endif//__CLIENT_CACHE_H__